Skip to content

Refactor: extract recent-color MRU logic into RecentColors helper#5

Merged
GamalAnwar merged 1 commit into
masterfrom
claude/solid-refactor-recent-colors
Jun 17, 2026
Merged

Refactor: extract recent-color MRU logic into RecentColors helper#5
GamalAnwar merged 1 commit into
masterfrom
claude/solid-refactor-recent-colors

Conversation

@GamalAnwar

Copy link
Copy Markdown
Contributor

Summary

Fourth SOLID-refactor slice (behavior-preserving): pull the recent-color list rule out of EditorView.

The de-dup / insert-at-front / cap-at-8 sequence for the editor's recent-color swatches was inline in the view. Extracted into a pure RecentColors.recording(_:into:limit:) function; the view now delegates to it. Trims a piece of the EditorView god object and makes the rule unit-testable.

Tests

RecentColorsTests (6 cases): insert into empty, new-to-front, existing-moves-to-front (no dup), cap dropping oldest, recording-at-capacity keeps count, custom limit.

🤖 Generated with Claude Code


Generated by Claude Code

The de-dup/insert/cap-at-8 sequence for the editor's recent-color swatches lived
inline in EditorView. Hoist it into a pure RecentColors.recording(_:into:limit:)
function (behavior-preserving) and have the view delegate to it. Adds
RecentColorsTests (6 cases).
@GamalAnwar GamalAnwar merged commit c464b60 into master Jun 17, 2026
1 check passed
@GamalAnwar GamalAnwar deleted the claude/solid-refactor-recent-colors branch June 18, 2026 07:36
GamalAnwar added a commit that referenced this pull request Jun 18, 2026
Hoist the editor's recent-color de-dup/insert/cap-at-8 rule out of EditorView
into a pure RecentColors.recording(_:into:limit:). Adds RecentColorsTests
(6 cases). Behavior-preserving.
GamalAnwar added a commit that referenced this pull request Jun 18, 2026
Hoist the editor's recent-color de-dup/insert/cap-at-8 rule out of EditorView
into a pure RecentColors.recording(_:into:limit:). Adds RecentColorsTests
(6 cases). Behavior-preserving.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants